@extends('admin.base')
	@section('content')
        <!-- Content Header (Page header) -->
        <section class="content-header">
          <h1>
            <i class="fa fa-calendar"></i>
			商品类别管理 
          </h1>
          <ol class="breadcrumb">
            <li><a href="{{url('admin')}}"><i class="fa fa-dashboard"></i> 首页</a></li>
            <li><a href="#">商品类别管理</a></li>
            <li class="active">添加商品类别信息</li>
          </ol>
        </section>

        <!-- Main content -->
        <section class="content">
          <div class="row">
            <!-- right column -->
            <div class="col-md-12">
              <!-- Horizontal Form -->
              <div class="box box-primary">
                <div class="box-header with-border">
                  <h3 class="box-title"><i class="fa fa-plus"></i> 添加类别信息</h3>
                </div><!-- /.box-header -->
                <!-- form start -->
				<form action="{{url('admin/type/$list->id')}}" method="post" id="myaddform" class="form-horizontal">
				  <input type="hidden" name="_token" value="<?php echo csrf_token(); ?>">
				  <input type="hidden" name="_method" value="put">
				  <input type="hidden" name="id" value="{{$list->id}}"/>
				  <input type="hidden" name="fid" value="{{$list->fid}}"/>
				  <div class="box-body">
					<div class="form-group">
					  <label for="inputEmail3" class="col-sm-3 control-label">商品板块：</label>
					  <div class="col-sm-4" class="form-control">
						<select name="fid" class="form-control">
							@foreach($list1 as $v)
								<option value="{{$v->id}}" disabled
								@if($list->fid == $v->id)
									selected
								@endif
								>{{$v->name}}</option>
							@endforeach
						</select>
					  </div>
					</div>
					<div class="form-group">
					  <label for="inputEmail3" class="col-sm-3 control-label">父类别名：</label>
					  <div class="col-sm-4" class="form-control">
						<select name="pid" id="pid" class="form-control">
							@if($list->pid == 0)
								<option value="0">无下属类别</option>
							@else
							@foreach($list2 as $v)
							<?php 
								$n =  $v->path;
								settype($n,'int');
							?>
							@if($n == $list->pid )
								<option value="{{$v->pid}}"
								@if($list->id == $v->id)
									selected
								@endif
								>{{$v->name}}</option>
							@endif
							@endforeach
							@endif
						</select>
					  </div>
					</div>
					<div class="form-group">
					  <label for="inputPassword3" class="col-sm-3 control-label">类别名称：</label>
					  <div class="col-sm-4">
						<input type="text" class="form-control" value="{{$list->name}}" placeholder="类别名称" name="name">
					  </div>
					</div>
				  </div><!-- /.box-body -->
				  <div class="box-footer">
				    <div class="col-sm-offset-4 col-sm-1">
						<button type="submit" class="btn btn-primary">修改</button>
                    </div>
					<div class="col-sm-1">
						<button type="reset"  class="btn btn-primary">重置</button>
					</div>
                  </div>
				</form>
				<div class="row"><div class="col-sm-12">&nbsp;</div></div>
              </div><!-- /.box -->
            </div><!--/.col (right) -->
          </div>   <!-- /.row -->
        </section><!-- /.content -->
    @endsection